package com.lm.bootfeign.controller;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public class TestArrayList {

    public static void main(String[] args) {

        try {
            List<Long> list = new ArrayList<Long>();

            Class c = ArrayList.class;

            Field field = c.getDeclaredField("elementData");
            field.setAccessible(true);
            Object[] o = (Object[]) field.get(list);
            System.out.println(o.length);


            list.add(1l);
            Object[] o1 = (Object[]) field.get(list);
            System.out.println(o1.length);
            for (int i = 0; i < o1.length; i++) {
//                System.out.println(o1[i]);
            }


            Integer[] ints = new Integer[]{};
            System.out.println(ints.length);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
